package Homework07;

import java.time.LocalDateTime;

public class User {
	private String username;
	private String password;
	private boolean isFreeze;
	private boolean isFreezeForever;
	private LocalDateTime time;
	private int numOfAttempts;
	private int numOfFreeze;
	
	public User(String username, String password, boolean isFreeze, boolean isFreezeForever, LocalDateTime time,
			int numOfAttempts, int numOfFreeze) {
		super();
		this.username = username;
		this.password = password;
		this.isFreeze = isFreeze;
		this.isFreezeForever = isFreezeForever;
		this.time = time;
		this.numOfAttempts = numOfAttempts;
		this.numOfFreeze = numOfFreeze;
	}
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + (isFreeze ? 1231 : 1237);
		result = prime * result + (isFreezeForever ? 1231 : 1237);
		result = prime * result + ((password == null) ? 0 : password.hashCode());
		result = prime * result + ((username == null) ? 0 : username.hashCode());
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		User other = (User) obj;
		if (isFreeze != other.isFreeze)
			return false;
		if (isFreezeForever != other.isFreezeForever)
			return false;
		if (password == null) {
			if (other.password != null)
				return false;
		} else if (!password.equals(other.password))
			return false;
		if (username == null) {
			if (other.username != null)
				return false;
		} else if (!username.equals(other.username))
			return false;
		return true;
	}
	
	@Override
	public String toString() {
		return "User [username=" + username + ", password=" + password + ", isFreeze=" + isFreeze + ", isFreezeForever="
				+ isFreezeForever + ", time=" + time + ", numOfAttempts=" + numOfAttempts + ", numOfFreeze="
				+ numOfFreeze + "]";
	}
	public User(String username, String password, boolean isFreeze, boolean isFreezeForever) {
		super();
		this.username = username;
		this.password = password;
		this.setFreeze(isFreeze);
		this.setFreezeForever(isFreezeForever);
	}
	public String getUsername() {
		return username;
	}
	public void setUsername(String username) {
		this.username = username;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	public User(String username, String password) {
		super();
		this.username = username;
		this.password = password;
	}
	public User() {
		super();
		// TODO Auto-generated constructor stub
	}
	public boolean isFreeze() {
		return isFreeze;
	}
	public void setFreeze(boolean isFreeze) {
		this.isFreeze = isFreeze;
	}
	public boolean isFreezeForever() {
		return isFreezeForever;
	}
	public void setFreezeForever(boolean isFreezeForever) {
		this.isFreezeForever = isFreezeForever;
	}
	public LocalDateTime getTime() {
		return time;
	}
	public void setTime(LocalDateTime time) {
		this.time = time;
	}
	public int getNumOfAttempts() {
		return numOfAttempts;
	}
	public void setNumOfAttempts(int numOfAttempts) {
		this.numOfAttempts = numOfAttempts;
	}
	public int getNumOfFreeze() {
		return numOfFreeze;
	}
	public void setNumOfFreeze(int numOfFreeze) {
		this.numOfFreeze = numOfFreeze;
	}

}
